#include<bits/stdc++.h>
using namespace std;
int CanUse[]={0,1,1,0,0,1,0,0,1,0,1,0,0,0,1,0,0,1,1,0,0,1,1,0,0,1,1,1,0,0,1};
int car[]={0,2,4,4,7,9,12,17,17,19,20,25,26,25,25,19,18,17,17,17,17,17,17,6,6,6,5,5,4,3};
double xi[]={0,1.38,1.15,1.318,0.964,1.096,1.945,1.506,2.267,1.241,1.012,1.589,1.865,0.779,1.233,2.428,1.738,1.612,1.14,1.034,1.8,1.161,0.827,1.592,0.721,1.026,1.35,0.792,1.491,2.111};
double ti[]={120,97,101,89,102,144,129,162,103,96,139,133,82,94,193,128,111,90,106,159,104,80,114,79,86,113,86,121,154};
int maxsize(int x,int y)
{
	int cnt=0;
	for(int i=x;i<=y;i++)
	{
		if(cnt<car[i])cnt=car[i];	
	}
	return cnt;
}
double xline(int x,int y)
{
	double cnt=0;
	for(int i=x;i<=y;i++)
	{
		cnt+=xi[i];
	}
	return cnt;
	
}
double tline(int x,int y)
{
	double cnt=0;
	for(int i=x;i<=y;i++)
	{
		cnt+=ti[i];
	}
	cnt+=(y-x+1)*120.0;
	return cnt;
	
}
int main()
{
	ofstream fout;
	fout.open("Answer.txt");
	for(int i=1;i<=29;i++)
		for(int j=i+1;j<=30;j++)
		{
			if(j-i+1<3||j-i+1>24)continue;
			if(CanUse[i]==0||CanUse[j]==0)continue;
			int a=i,b=j;
			int BigLine=max(maxsize(1,a-1),maxsize(b,29));
			int ShortLine=maxsize(1,29)-BigLine;
			if(ShortLine<=0)continue;
			double cost=BigLine*xline(1,29)/tline(1,29)+ShortLine*xline(a,b-1)/tline(a,b-1);
			fout<<a<<" "<<b<<" "<<BigLine<<" "<<ShortLine<<" "<<cost<<endl;		
		}
	return 0;
}
